package cn.tedu.spring.life;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component
public class Life {

    private String meaning;

    public Life() {
        System.out.println("1.无参构造实例化");
    }
    @Value("生命的意义在于享受~！")
    public void setMeaning(String meaning) {
        this.meaning = meaning;
        System.out.println("2.通过set方法进行属性赋值");
    }

    @PostConstruct
    public  void  init(){
        System.out.println("3.bean对象声明周期初始化之前执行的方法 下一步初始化");
    }
    @PreDestroy
    public void destoty(){
        System.out.println("5.销毁之前执行的方法 下一步销毁");
    }
}
